package com.mlog.njyjy.ndop.share.sql.core;

import java.util.concurrent.ConcurrentHashMap;

/**
 * <p>
 * dao 容器
 * - 查询关联表时：
 * <code>
 *
 * </code>
 * </p>
 *
 * @author <a href="mailto:yingxiufeng@mlogcn.com">alex</a>
 * @version v1.0, 2020/8/11
 */
public enum ModelDaoContainer {
    // singleton
    INSTANCE;

    private final ConcurrentHashMap<Class<?>, Object> repository = new ConcurrentHashMap(2);

    public <T> T put(T dao) {
        this.repository.put(dao.getClass(), dao);
        return dao;
    }

    public <T> T get(Class<T> clazz) {
        return (T) this.repository.get(clazz);
    }
}
